{# SPDX-License-Identifier: Apache-2.0 -#}

{% extends "admin/base.html" %}

{% import "admin/utils/pagination.html" as pagination %}
{% block title %}Malware Reports{% endblock %}

{% block breadcrumb %}
  <li class="breadcrumb-item">
    <a href="{{ request.route_path("admin.observations.list") }}">Observations</a>
  </li>
  <li class="breadcrumb-item active">Malware Reports</li>
{% endblock %}

{% block content %}
  <div class="card">
    <div class="card-header">
      <h3 class="card-title">Malware Reports</h3>
    </div>
    <div class="card-body">
      <div class="table-responsive">
        <table class="table table-hover" id="malware-reports">
          <thead>
            <tr>
              <th>Project Name</th>
              <th>Summary</th>
              <th>Created</th>
              <th>Reported By</th>
              <th>Details</th>
            </tr>
          </thead>
          <tbody>
            {% for report in malware_reports %}
              <tr>
                <td>
                  <a href="{{ request.route_path('admin.malware_reports.project.list', project_name=report.related.name) }}">
                    {{ report.related.name }}
                  </a>
                </td>
                <td>{{ report.summary }}</td>
                <td>
                  <time datetime="{{ report.created }}">{{ report.created }}</time>
                </td>
                <td>
                  <a href="{{ request.route_path('admin.user.detail', username=report.observer.parent.username) }}">{{ report.observer.parent.username }}</a>
                </td>
                <td>
                  <a href="{{ request.route_path('admin.malware_reports.detail', observation_id=report.id) }}"
                     class="btn btn-sm btn-primary"><i class="fa-regular fa-eye"></i></a>
                </td>
              </tr>
            {% endfor %}
          </tbody>
        </table>
      </div>
    </div>
    <div class="card-footer">{# TODO: add pagination #}</div>
  </div>
{% endblock %}
